package com.bupt.uchouten.common.register;

import com.bupt.uchouten.common.util.Reference;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraftforge.registries.RegisterEvent;

import java.util.HashMap;
import java.util.Map;

public class UchoutenSounds {

    static final Map<ResourceLocation, SoundEvent> registeredEvents = new HashMap<>();

    public static final SoundEvent TENKAI_VIGOROUS_VINE_HEALING = registerSound("tenkai_vigorous_vine.healing");
    public static final SoundEvent EARTHQUAKE = registerSound("sword_of_scarlet_perception.earthquake");

    private static SoundEvent registerSound(String name) {
        ResourceLocation location = new ResourceLocation(Reference.MODID, name);
        SoundEvent event = SoundEvent.createVariableRangeEvent(location);
        registeredEvents.put(location, event);
        return event;
    }

    public static void init(RegisterEvent event) {
        event.register(Registries.SOUND_EVENT, helper -> registeredEvents.forEach(helper::register));
    }
}
